package com.zjitc.P1;

import com.zaxxer.hikari.HikariDataSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

/**
 * Create by IntelliJ IDEA
 *
 * @author: jsonor
 * @date-Time: 2018/3/13 14:06
 * @description:
 */
@Configuration
@Import(DataSourceConfig.class)
public class SpringConfiguration {

  @Bean(name = "DataSource")
  public HikariDataSource dataSource (DataSource ds){
    HikariDataSource dataSource = new HikariDataSource();
    dataSource.setUsername(ds.getUsername());
    dataSource.setPassword(ds.getPassword());
    dataSource.setDriverClassName(ds.getDriver());
    dataSource.setJdbcUrl(ds.getJdbcUrl());
    return dataSource;
  }
}
